package com.lz.library.adapter.anim

import android.animation.Animator
import android.animation.ObjectAnimator
import android.view.View

/**
 *  author: you : 2020/4/25
 */
class SlideInAnimation(private val mOrientation: Int = LEFT) : IAnimation {

    companion object {
        const val LEFT = 0x00000000
        const val RIGHT = 0x00000004
        const val BOTTOM = 0x00000008
    }

    override fun getAnimators(view: View): Array<Animator> {
        return when (mOrientation) {
            RIGHT -> arrayOf(ObjectAnimator.ofFloat(view, "translationX", view.rootView.width.toFloat(), 0f))
            BOTTOM -> arrayOf(ObjectAnimator.ofFloat(view, "translationY", view.measuredHeight.toFloat(), 0f))
            else -> arrayOf(ObjectAnimator.ofFloat(view, "translationX", -view.rootView.width.toFloat(), 0f))
        }
    }
}